/*
 * @Author: hucc
 * @Date: 2021-09-27 09:06:44
 * @LastEditors: hucc
 * @LastEditTime: 2021-10-05 19:27:43
 * @Description: 
 */

//函数在内存区内至少占两片空间  至少有构造函数和构造函数原型两片
//函数也可以设置默认值
let myFun1 = function(a, b, c = 10) {
    console.log(a, b, c);
    console.log(arguments); //[Arguments] { '0': null, '1': 2 } 类数组对象
}
myFun1(null, 2); //null 2 10
//myFun1(null, 2, 3);//null 2 3


//函数参数-对象解构
let myFun2 = function({ a, b, c }) {
        console.log(a, b, c); //1 tom 2
    }
    //let {a,b,c}={ a: 1, c: 2, b: "tom"}
myFun2({ a: 1, c: 2, b: "tom" });

//函数参数-数组解构
let myFun3 = function([a, b, c]) {
    console.log(a, b, c); //undefined 2 3
}
myFun3([, 2, 3]);

//...拓展运算符用在函数形参位置 叫做rest参数 也叫做拓展运算符的逆运算
let myFun4 = function(a, ...b) {
    console.log(a, b); //1 [2,3,4,5,6]
}
myFun4(1, 2, 3, 4, 5, 6);